﻿using System.Collections.Generic;

namespace d1Project.Tools.PagedList
{
    /// <summary>
    /// Represents a subset of a collection of objects that can be individually accessed by index and containing metadata about the superset collection of objects this subset was created from.
    ///  表示可以通过索引以及有关的对象从创建该子集的超集集合包含元数据逐个访问的对象的集合的一个子集。
    /// </summary>
    /// <typeparam name="T">The type of object the collection should contain.(集合应包含的对象类型)</typeparam>
    /// <seealso cref="IEnumerable{T}"/>
    public interface IPagedList<out T> : IPagedList, IEnumerable<T>
    {
        ///<summary>
        /// Gets the element at the specified index.
        ///  获取指定索引的元素
        ///</summary>
        T this[int index] { get; }

        ///<summary>
        /// Gets the number of elements contained on this page.
        ///  获取此页面上包含的元素数。
        ///</summary>
        int Count { get; }

        ///<summary>
        /// Gets a non-enumerable copy of this paged list.
        /// 获取此分页列表非可枚举的副本。
        ///</summary>
        //IPagedList GetMetaData();
    }

    /// <summary>
    /// Represents a subset of a collection of objects that can be individually accessed by index and containing metadata about the superset collection of objects this subset was created from.
    /// </summary>
    public interface IPagedList
    {
        /// <summary>
        /// Total number of subsets within the superset.(总页数)
        /// </summary>
        int PageCount { get; }

        /// <summary>
        /// Total number of objects contained within the superset.(总条数)
        /// </summary>
        int TotalItemCount { get; }

        /// <summary>
        /// One-based index of this subset within the superset.(当前页)
        /// </summary>
        int PageNumber { get; }

        /// <summary>
        /// Maximum size any individual subset.(每页大小)
        /// </summary>
        int PageSize { get; }

        /// <summary>
        /// Returns true if this is NOT the first subset within the superset.(是否有上一页)
        /// </summary>
        bool HasPreviousPage { get; }

        /// <summary>
        /// Returns true if this is NOT the last subset within the superset.(是否有下一页)
        /// </summary>
        bool HasNextPage { get; }

        /// <summary>
        /// Returns true if this is the first subset within the superset.(是否为第一页)
        /// </summary>
        bool IsFirstPage { get; }

        /// <summary>
        /// Returns true if this is the last subset within the superset.(是否为最后一页)
        /// </summary>
        bool IsLastPage { get; }

        /// <summary>
        /// One-based index of the first item in the paged subset.(页中第一条记录的索引)
        /// </summary>
        int FirstItemOnPage { get; }

        /// <summary>
        /// One-based index of the last item in the paged subset.(页中最后一条记录的索引)
        /// </summary>
        /// <value>
        int LastItemOnPage { get; }
    }
}
